package com.example.administrator.yuejian_15.activity;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.example.administrator.yuejian_15.R;


public abstract class BaseActivity extends AppCompatActivity {

    protected int layout_file= R.layout.activity_main;
    abstract void initView();
    abstract void initEvent();
    abstract void initDate();
    void setLayout_file(int layout_file){
        setContentView(layout_file);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
        initDate();
        initEvent();
    }

    public String getuser(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("username","");
    }

    public String getpass(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo",Context.MODE_PRIVATE);
        return sp.getString("userpass","");
    }
    public String getid(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo",Context.MODE_PRIVATE);
        return sp.getString("userid","");
    }

    public Boolean getUer_remember(){
        SharedPreferences sp;
        sp=getSharedPreferences(
                "userInfo",MODE_PRIVATE);
        return sp.getBoolean("remember",false);
    }

}
